const moment = require("moment");
const { PUSH_PLUS_TOKEN } = require("./config/index");
const { pushPlus } = require("./request/api");

// 微信推送结果
async function pushWechat(content) {
    console.log(PUSH_PLUS_TOKEN);
    const { data } = await pushPlus({
        token: PUSH_PLUS_TOKEN,
        title: `掘金程序 ${moment().format("YYYY-MM-DD HH:mm:ss")}`,
        content,
        template: "html"
    });
    console.log(`微信消息推送${data.code === 200 ? "成功" : "失败: " + data.msg}`);
}

module.exports = {
    pushWechat
}